<h1>文章列表</h1>
<table width="100%"   cellspacing="4" cellpadding="4" border="0" align="center" bgcolor="#f0f0f0">
<tbody>


<tr BGCOLOR=#FFCC33>
    <td>Title</td>
    <td>User</td>
    <td>Category</td>
    <td>Counts</td>
    <td>Time</td>
    <td>Action</td> 
</tr>
  
<% for topic in @topics %>


<tr>
 
    <td>
    <% if topic.istop.to_i == 1 %>
    <%=link_to "<font color=\"#FF0000\">置顶</font>",{ :action => 'notop', :id => topic }%>
	<% end %>
    <%= link_to "#{topic.title}",{:controller => "topic", :action => "view",:id=>topic.id},{:title=>topic.body}%></td>
    <td><%=topic.user.display_name%></td>
    <td><%=link_to topic.category.title ,{:controller => "/admin/category", :action => "view",:id=>topic.category_id},
    {:title=>topic.category.description} %></td>
    <td><%=topic.views_count%>/<%=topic.comments_count%></td>
    <td><%=topic.created_at.to_s(:short)%></td>


    <td><%= link_to '编辑', :action => 'edit', :id => topic %>
    ,<%= link_to '删除', { :action => 'destroy', :id => topic }, :confirm => 'Are you sure?', :method => :post %></td>

 </tr>

<% end %>
</tbody>
</table>

<%= link_to 'Previous page', { :page => @topic_pages.current.previous } if @topic_pages.current.previous %>
<%= link_to 'Next page', { :page => @topic_pages.current.next } if @topic_pages.current.next %> 

<br />
<%= link_to 'New topic', :action => 'new' %>


